package com.hospital.controller;

import com.hospital.constant.MessageConstant;
import com.hospital.dto.PatientPageQueryDTO;
import com.hospital.result.PageResult;
import com.hospital.result.Result;
import com.hospital.service.TreatmentRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
@RequestMapping("/treatmentRecord")
@Slf4j
@Api(tags = "5.治疗记录")
public class TreatmentRecordController {
    @Autowired
    private TreatmentRecordService treatmentRecordService;

    @GetMapping("/")
    @ApiOperation("获取治疗记录")
    public Result<PageResult> getTreatmentRecord(PatientPageQueryDTO patientPageQueryDTO) {
        log.info("获取治疗记录: {}", patientPageQueryDTO);
        PageResult pageResult = treatmentRecordService.getTreatmentRecord(patientPageQueryDTO);
        return Result.success(pageResult, MessageConstant.QUERY_SUCCESS);
    }
}
